export {};

/**
 * 将联合类型变成交叉类型
 */
type UnionToIntersection<T> = (
  T extends any ? (args: T) => any : never
) extends (args: infer P) => any
  ? P
  : never;
type Asd = { name: string } | { sex: number } | { age: boolean };
type Asd2 = UnionToIntersection<Asd>; // "a" & "b" & "c"

type B = ((args: { name: string }) => any) extends (
  args: {
    name: string;
  } & {
    sex: number;
  }
) => any
  ? 1
  : 2;

type Type2<T> = string | number extends T ? "A" : "B"; // 等价于 string extends T ? 'a' : 'b'; number extends T ? "A" : "B"

type C<T> = T extends string ? T : never;
type D = C<number>;
